Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Python dtype conversion for int64 on Windows. #12880

Merged
merged 2 commits into from
Apr 3, 2023

Conversation

ScottTodd
Copy link
Member

Fixes #11080. The int64 and uint64 test cases here were failing on Windows as the element type mapping was routing via the code l, which is a "C long int" - not an explicitly 64 bit type. This changes the mapping to always use the explicit "type strings" (any string in numpy.sctypeDict.keys(), shown in this gist).

Relates to #12872

@ScottTodd ScottTodd added platform/windows 🚪 Windows-specific build, execution, benchmarking, and deployment bindings/python Python wrapping IREE's C API labels Mar 31, 2023
Comment on lines +414 to +421
// See:
// * https://numpy.org/doc/stable/reference/arrays.dtypes.html
// * https://docs.python.org/3/c-api/arg.html#numbers
//
// Single letter codes can be ambiguous across platforms, so prefer explicit
// bit depth values, ("Type strings: Any string in numpy.sctypeDict.keys()").
// See https://github.com/pybind/pybind11/issues/1908
const char* dtype_string;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Eliasj42 , this is changing the same code as your #12872 (nice timing on that and @allieculp 's ping on the Windows issue!). I think adding a complex test case to runtime/bindings/python/tests/vm_types_test.py might be enough for your PR, but we should also add more e2e tests using complex to ensure it works across all the layers.

Copy link
Member

@jpienaar jpienaar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Do we tests in place to fail if we regress? (I assume the test newly enabled on Windows)

@ScottTodd
Copy link
Member Author

Nice catch! Do we tests in place to fail if we regress? (I assume the test newly enabled on Windows)

Yeah, the newly enabled test covers this. We could still use some pure-python (no TF / other frameworks) tests that go through a more complete workflow with each data type though.

@ScottTodd ScottTodd merged commit 51dbeb8 into iree-org:main Apr 3, 2023
@ScottTodd ScottTodd deleted the python-windows branch April 3, 2023 16:36
jpienaar pushed a commit that referenced this pull request May 1, 2023
Fixes #11080. The int64 and uint64
test cases here were failing on Windows as the element type mapping was
routing via the code `l`, which is a "C long int" - not an explicitly 64
bit type. This changes the mapping to always use the explicit "type
strings" (any string in `numpy.sctypeDict.keys()`, [shown in this
gist](https://gist.github.com/ScottTodd/ec1f7906e9c644eb47f74280d6c26229)).

Relates to #12872
NatashaKnk pushed a commit to NatashaKnk/iree that referenced this pull request Jul 6, 2023
Fixes iree-org#11080. The int64 and uint64
test cases here were failing on Windows as the element type mapping was
routing via the code `l`, which is a "C long int" - not an explicitly 64
bit type. This changes the mapping to always use the explicit "type
strings" (any string in `numpy.sctypeDict.keys()`, [shown in this
gist](https://gist.github.com/ScottTodd/ec1f7906e9c644eb47f74280d6c26229)).

Relates to iree-org#12872
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bindings/python Python wrapping IREE's C API platform/windows 🚪 Windows-specific build, execution, benchmarking, and deployment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arrays do not match in python/vm_types_test:test_variant_list_buffers on Windows
2 participants